using SSO.OAuth.Util;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllersWithViews();
builder.Services.AddHttpClient();
builder.Services.AddMemoryCache();
builder.Services.AddSingleton<IJWTService, JWTHSService>(); //对称加密
//builder.Services.AddSingleton<IJWTService, JWTRSService>(); //非对称加密
builder.Services.AddSingleton<Cachelper>();
builder.Services.Configure<AppSettingOptions>(builder.Configuration.GetSection("AppSetting"));


var app = builder.Build();
if (!app.Environment.IsDevelopment()) {
    app.UseExceptionHandler("/Home/Error");
    app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllerRoute(name: "default", pattern: "{controller=Home}/{action=Index}/{id?}");
app.Run();